<template>
  <div>
      <el-row type="flex" justify="end">
          <el-select v-model="currentMonth" size="small" style="width: 120px;">
              <el-option v-for="item in 12" :key="item" :label="item" :value="item">
              </el-option>
          </el-select>
          <el-select v-model="currentYear" size="small" style="width: 120px;margin-left: 10px">
              <el-option v-for="item in yearList" :key="item" :label="item" :value="item">
              </el-option>
          </el-select>
      </el-row>
    <el-calendar v-model="value"> </el-calendar>
  </div>
</template>

<script>
export default {
  name: "WorkCalendar",
  data() {
      //用es5循环11个数
    /* 
    for (var i = -5; i <= 5; i++) {
      yearList.push(currentDate.getFullYear() + i);
    }
    */
    /* 用es6循环11个数
    let a = Array.from(new Array(11));
    a.forEach((t, i) => {
      yearList.push(currentDate.getFullYear() + i - 5);
    });
    */
    return {
      value: currentDate,
      currentMonth: currentDate.getMonth() + 1,
      currentYear: currentDate.getFullYear(),
      yearList
    };
  },
  created() {},
  mounted() {},
  computed: {},
  components: {},
  methods: {}
};
</script>

<style lang="less" scoped>
</style>